<% # @page_title="Hosts" %>
<% @mselect_hosts=1 %>
<% @table = @hosts %>
<% @action = "index" %>
<% @cont = "hosts" %>

<%= render :partial => 'layouts/page_count' %>

<table>
<thead>
  <tr>
    <th scope="col">
      <%= sort_link("Test Area", "session_test_area") %>
      <%= filterx_icon("Remove filter on #{session[:test_area]}", session[:test_area], :test_area, {:controller => 'test_areas', :action => 'set', :id => 'all'}) %>
    </th>

    <th scope="col">
      <%= sort_link("IP Address", "ip_address") %>
      <%= filterx_icon("Remove filter on host", @url_params[:host_id_v], :host_id_v, {:controller => @cont}) %>
    </th>

    <th scope="col">
      <%= sort_link("Hostname", "hostname") %>
      <%= filterx_icon("Remove filter on host", @url_params[:hostname_v], :hostname_v, {:controller => @cont}) %>
    </th>

    <th scope="col">
      <%= sort_link("Type", "name_type") %>
      <%= filterx_icon("Remove filter on host", @url_params[:name_type_v], :name_type_v, {:controller => @cont}) %>
    </th>
  </tr>
</thead>

<tbody>
<%
odd_or_even = 0
for host in @hosts
    odd_or_even = 1 - odd_or_even
%>
  <tr class="odd<%=h odd_or_even %>">
    <td><%=h host.test_area_name %>
        <%= filter_icon("Show only #{host.test_area_name}", session[:test_area], {:controller => 'test_areas', :action => 'set', :id => host.test_area_id}) %>
    </td>

    <td><%= link_to_host(host.ip_address, {:controller => 'nmap_infos', :host_id_v => host.id}) %>
       <%= filter_icon("Show only #{host.ip_address}", @url_params[:host_id_v], {:controller => 'hosts', :host_id_v => host.id}) %>
    </td>

    <% if host.hostname.blank? %>
      <td></td>
    <% else %>
      <td><%=h host.hostname%>
       <%= filter_icon("Show only #{host.hostname}", @url_params[:hostname_v], {:controller => 'hosts', :hostname_v => host.hostname}) %>
      </td>
    <% end %>

    <% if host.name_type.blank? %>
      <td></td>
    <% else %>
      <td><%=h host.name_type%>
       <%= filter_icon("Show only #{host.name_type}", @url_params[:name_type_v], {:controller => 'hosts', :name_type_v => host.name_type}) %>
      </td>
    <% end %>
  </tr>
<% end %>
</tbody>
</table>

<%= render :partial => 'layouts/page_count' %>
